function formatData(response) {
  return response.data.map((item) => {
    return {
      id: item.id,
      ...item.attributes,
      product_type: item.attributes.product_type
        ? {
            id: item.attributes.product_type.data.id,
            ...item.attributes.product_type.data.attributes,
          }
        : null,
      pic: item.attributes.pic
        ? item.attributes.pic.data.map((pic) => ({
            id: pic.id,
            ...pic.attributes,
          }))
        : [],
    };
  });
}
function formatCertificateData(response) {
  return response.data.map((item) => {
    return {
      id: item.id,
      ...item.attributes,
      certificate_type: item.attributes.certificate_type
        ? {
            id: item.attributes.certificate_type.data.id,
            ...item.attributes.certificate_type.data.attributes,
          }
        : null,
      pic: item.attributes.pic
        ? item.attributes.pic.data.map((pic) => ({
            id: pic.id,
            ...pic.attributes,
          }))
        : [],
    };
  });
}
window.UTIL_TOOL = {
  formatData,
  formatCertificateData
}